package com.woniuxy.producer.config.confirm;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 消息确认可靠性绑定
 */
@Configuration
public class ConfirmFanoutConfig {
    //创建2个队列，1个交换机
    @Bean
    public Queue confirmQueue(){
        return new Queue("confirm-queue");
    }
    @Bean
    public DirectExchange confirmDirectExchange(){
        return new DirectExchange("confirm-direct-exchange");
    }
    // 队列绑定到交换机
    @Bean
    public Binding bingdingConfirm(Queue confirmQueue,DirectExchange confirmDirectExchange){
        return BindingBuilder.bind(confirmQueue).to(confirmDirectExchange).with("msg.confirm");
    }
}